package DOM;

import javax.rmi.CORBA.Util;

public class Articles {

	public static final String category = "category";
	public static final String cateStart = "<"+category+">";
	public static final String cateEnd = "</"+category+">";
	
	public static void kohsantipheap(String url){
		System.out.println("kohsantipheap");
		String RegTitle = "div#article > h1";
		String RegDate = "div.info > p.published";
		String RegCateg = "li.current > a";
		String RegAuth = "div.info > p.author";
		String RegContent = "div.body";
		
		ArticlesFilter.filterArticles(url, RegTitle, RegDate, RegAuth, RegCateg, RegContent);
	}
	
	public static void camnews(String url){
		System.out.println("camnews");
		String RegTitle = "h1.entry-title";
		String RegDate = "div.entry-meta";
		String RegCateg = "div#breadcrumbs > a:nth-child(2)";
		String RegAuth = "author";
		String RegContent = "div.entry-content";
		
		ArticlesFilter.filterArticles(url, RegTitle, RegDate, RegAuth, RegCateg, RegContent);
	}
	
	public static void voanews(String url){
		System.out.println("voanews");
		String RegTitle = "div#article > h1";
		String RegDate = "p.article_date";
		String RegCateg = "h2.sitetitle";
		String RegAuth = "div.author";
		String RegContent = "div#ctl00_ctl00_cpAB_cp1_cbcContentBreak";
	
		ArticlesFilter.filterArticles(url, RegTitle, RegDate, RegAuth, RegCateg, RegContent);
	}
	
	public static void rfa(String url){
		System.out.println("rfa");
		String RegTitle = "div#storypagemaincol > h1:first-of-type";
		String RegDate = "span#story_date";
		String RegCateg = "div#breadcrumbs > p > a";
		String RegAuth = "span#story_byline";
		String RegContent = "div#storytext";
		
		ArticlesFilter.filterArticles(url, RegTitle, RegDate, RegAuth, RegCateg, RegContent);
	}
	
	public static void kptnews(String url){
		System.out.println("kptnews");
		
		Utils.writeCate2files(url+"/local-news", cateStart+"ព័ត៌មាន​ជាតិ "+cateEnd);
		Utils.writeCate2files(url+"/international-news", cateStart+"ព័ត៌មាន​អន្តរជាតិ"+cateEnd);
		Utils.writeCate2files(url+"/2010-09-27-04-37-14", cateStart+"បទអត្ថាធិប្បាយ"+cateEnd);
		Utils.writeCate2files(url+"/culture-art", cateStart+"សិល្បៈ​និងវប្ប​​​ធម៌"+cateEnd);
		Utils.writeCate2files(url+"/sport", cateStart+"ព័ត៌​មានកីឡា"+cateEnd);
		Utils.writeCate2files(url+"/writer-vision", cateStart+"ទស្សនៈស្មេរ"+cateEnd);
		
		String RegTitle = "h1.contentheading";
		String RegDate = "dl.article-info > dd.create";
		String RegCateg = Articles.category;
		String RegAuth = "nofilter";
		String RegContent = "div.article-content";
		
		ArticlesFilter.filterArticles(url, RegTitle, RegDate, RegAuth, RegCateg, RegContent);
	}

	public static void fpmonline(String url){
		System.out.println("fpmonline");
		String RegTitle = "h2.h2title";
		String RegDate = "p.postmeta";
		String RegCateg = "p.browse > a[rel=category tag]";
		String RegAuth = "p.postmeta > b";
		String RegContent = "div.entry > p";
		
		ArticlesFilter.filterArticles(url, RegTitle, RegDate, RegAuth, RegCateg, RegContent);
	}
	
	public static void healthcambodia(String url){
		System.out.println("healthcambodia");
		String RegTitle = "div.post > h2";
		String RegDate = "div.entry > p:nth-last-of-type(2)";
		String RegCateg = "div.breadcrumbs > a:nth-child(2)";
		String RegAuth = "div.entry > p:nth-last-of-type(2)";
		String RegContent = "div.entry > p";
		
		ArticlesFilter.filterArticles(url, RegTitle, RegDate, RegAuth, RegCateg, RegContent);
	}
	
	public static void ksnnews(String url){
		System.out.println("ksnnews");
		
		KSNFilter.FilesFilter(url);
		
		Utils.writeCate2files(url+"/health", cateStart+"សុខភាព"+cateEnd);
		Utils.writeCate2files(url+"/hi-tech", cateStart+"បច្ចេកវិទ្យា"+cateEnd);
		Utils.writeCate2files(url+"/localnews", cateStart+"ព័ត៌មាន​ជាតិ"+cateEnd);
		Utils.writeCate2files(url+"/political", cateStart+"នយោបាយ"+cateEnd);
		Utils.writeCate2files(url+"/world", cateStart+"ព័ត៌មាន​អន្តរជាតិ"+cateEnd);
		Utils.writeCate2files(url+"/youth-education", cateStart+"អប់រំ"+cateEnd);
		
		String RegTitle = "div.item-page > h1.contentheading";
		String RegDate = "dl.article-info > dd.create";
		String RegCateg = Articles.category;
		String RegAuth = "dl.article-info > dd.createdby";
		String RegContent = "div.article-content";
		
		ArticlesFilter.filterArticles(url, RegTitle, RegDate, RegAuth, RegCateg, RegContent);
	}
	
	public static void phnompenhdailynews(String url){
		System.out.println("phnompenhdailynews");
		
//		KSNFilter.FilesFilter(url);
//		
//		Utils.writeCate2files(url+"/health", cateStart+"សុខភាព"+cateEnd);
//		Utils.writeCate2files(url+"/hi-tech", cateStart+"បច្ចេកវិទ្យា"+cateEnd);
//		Utils.writeCate2files(url+"/localnews", cateStart+"ព័ត៌មាន​ជាតិ"+cateEnd);
//		Utils.writeCate2files(url+"/political", cateStart+"នយោបាយ"+cateEnd);
//		Utils.writeCate2files(url+"/world", cateStart+"ព័ត៌មាន​អន្តរជាតិ"+cateEnd);
//		Utils.writeCate2files(url+"/youth-education", cateStart+"អប់រំ"+cateEnd);
		
		String RegTitle = "div.item-page > h1.contentheading";
		String RegDate = "dl.article-info > dd.create";
		String RegCateg = Articles.category;
		String RegAuth = "dl.article-info > dd.createdby";
		String RegContent = "div.article-content";
		
		ArticlesFilter.filterArticles(url, RegTitle, RegDate, RegAuth, RegCateg, RegContent);
	}
	
}
